package com.atguigu.lease.common.converter.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;


/**
 * @author yjf
 * @version 1.0
 * @description: 自动填充处理器
 * @date 2024/9/6 22:34
 */
@Component
public class MyMetaDataObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
      this.strictInsertFill(metaObject,"createTime", Date.class,new Date());
      this.strictInsertFill(metaObject,"isDeleted", Byte.class,(byte) 0);

    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
    }
}
